const express = require( 'express' );
const bodyParser = require( 'body-parser' );
const textConfig = require( './web/text.js' );
const {file} = require( './web/text.js' );
const app = express();
app.listen( 8080 );
app.use( bodyParser( {
    extended: false
} ) );
let count = 3;
let i = 5;
app.post( '/loginCopy', ( req, res ) => {
    console.log( req.body );
    const userMsg = req.body;
    i--;
    if ( i > 0 ) {
        count--;
        if ( userMsg.username == file.name && userMsg.password == file.password ) {
            if ( count > 0 ) {
                console.log( '登录成功' );
                res.send( '登录成功' );
                console.log( count );
            } else {
                console.log( '今天登录次数超过3次' );
                res.send( '今天登录次数超过3次' );
            }
        } else {
            res.send( '密码错误' )
        }
    } else {
        res.send( '今天已经输错5次，明天再试吧' );
        console.log( '今天已经输错5次，明天再试吧' );
        return;
    }
} )